using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Zadatak_0
{
    class Program
    {
        static void Main(string[] args)
        {
            int n,br,i;

              n = Convert.ToInt32(Console.ReadLine());
             List<string> Lista = new List<string>();

            for (i = 0; i < n; i++)
            {
                Lista.Add(Console.ReadLine());
            }
            
            br = 0;
            
            for (i = 0; i < n; i++)
            {
                if ((Lista.Count < 5) || (Lista[i][0] == 'A'))
                {
                    br = br + 1;
                }
            }

            Console.WriteLine(br);

            Console.ReadKey();
        }
    }
}